/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package sql;

import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;

/**
 *
 * @author 马凯
 */

public class Select {
    private static Select local;
    final String url = "jdbc:mysql://localhost/isc?user=root&password=root&useUnicode=true";
    private Connection selectOpt;
    private Statement selectStatement;
    private ResultSet result;
    private String sql;

    public static Select getInstance(){
        if(local==null){
            local = new Select();
        }
        return local;
    }
    
    public ResultSet selectValue(String temp)
    {
        sql=temp;
        System.out.println(sql);
        try{
        Class.forName("com.mysql.jdbc.Driver");
        selectOpt = DriverManager.getConnection(url);
        selectOpt.setCatalog("isc");
        selectStatement=selectOpt.createStatement();
        result=selectStatement.executeQuery(sql);
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
        return result;
    }



}
